<template>
  <el-dialog :title="title" center  :visible.sync="openState" v-if="openState" :close-on-click-modal="false" width="900px" append-to-body>
    <div class="discountReceipt-pick-operate-box">
      <div class="operate-box-top">
        <Ht-search-form
          :defaultEventKey="defaultSearchKey"
          :dictMap="dictMap"
          :queryParams="queryParams"
          :outputQueryParams="queryParams"
          :formOptions="formOptions"
          :advOptions="[]"
          :labelWidth="90"
        ></Ht-search-form>
      </div>
      <div class="operate-box-bottom">
        <div class="bottom-content">
          <ht-table
            :defaultEventKey="defaultSearchKey"
            ref="dataTable"
            rowKey="actNo"
            :showSerialNumber="false"
            :multi-select="false"
            :dictMap="dictMap"
            :reqConfig="reqConfig"
            :queryParams="queryParams"
            :tableBindColumns="tableBindColumns"
            :showRightToolbar="false"
          >
            <template v-slot:operate>
              <el-table-column
                label="操作"
                align="center"
                fixed="left"
                width="160"
                class-name="small-padding fixed-width"
              >
                <template slot-scope="scope">
                  <ht-button-group
                    :buttonList="[
                      {
                        label: '选择',
                        doFunc: () => {
                          confirm(scope.row);
                        },
                      },
                    ]"
                  />
                </template>
              </el-table-column>
            </template>
          </ht-table>
        </div>
      </div>
    </div>
  </el-dialog>
</template>

<script>
import { Cnaps2OtherBankCust } from "@/api/cnaps/common/custInfo";
export default {
  name: "PayeeDialog",
  props: {},
  data() {
    return {
      title: "",
      defaultSearchKey: "payee-dialog",
      openState: false,
      // 来源标识 为了服用区分是哪个选项触发的
      fromFlag: "",
      dictMap: {},
      tableLoadingState: false,
      formOptions: [],
      queryParams: {
        actNo: "",
        name: "",
      },
      refName: '',
      reqConfig: Cnaps2OtherBankCust,
      tableBindColumns: [
        { label: `客户账号`, prop: "actNo" },
        { label: `客户名称`, prop: "name" },
        { label: `客户地址`, prop: "addr" },
        { label: `收款行行号`, prop: "rcvBrno" },
        { label: `收款行行名`, prop: "rcvBrname" },
        { label: `收款行开户行行号`, prop: "accBrno" },
        { label: `收款行开户行行名`, prop: "accBrnoName" },
      ],
    };
  },
  mounted() {
    const formOptions = [
      {
        type: "input",
        prop: "actNo",
        defaultAttr: {
          size: "small",
          label: "客户账号",
          placeholder: "请输入客户账号",
        },
      },
      {
        type: "input",
        prop: "name",
        defaultAttr: {
          size: "small",
          label: "客户名称",
          placeholder: "请输入客户名称",
        },
      },
    ];
    this.formOptions = formOptions;
  },
  methods: {
    show(fromFlag = "", refName = '') {
      this.openState = true;
      this.$set(this.queryParams,"actNo","");
      this.$set(this.queryParams,"name","");
      this.fromFlag = fromFlag;
      this.refName = refName;
    },
    close() {
      this.openState = false;
    },
    loadData() {},
    // 点击确认数据
    confirm(row) {
      this.$emit("confirm", this.fromFlag, row, this.refName);
      this.openState = false;
    },
  },
};
</script>

<style scoped></style>
